<template>
  <div class="body">
    <h3>系统设备管理</h3>
    <div>
      <a-row type="flex" justify="start">
        <a-col :span="6"
          ><span>公司：</span>
          <j-dict-select-tag style="width: 80%" placeholder="请选择公司" v-model="queryParam.company" dictCode="crm_company,name,id" />
        </a-col>
        <a-col :span="6"
          ><span>设备号：</span>
          <a-input v-model="queryParam.deviceNo" placeholder="请输入设备号" style="width: 250px"></a-input>
        </a-col>
        <a-col :span="4">
          <a-space style="margin-left: 10px">
            <a-button type="primary" @click="handleSearch()" icon="search">查询</a-button>
            <a-button type="primary" @click="handleReset()" icon="reload" style="margin-left: 8px">重置</a-button>
          </a-space>
        </a-col>
      </a-row>
      <a-row>
        <a-col :span="4">
          <a-space style="margin-top: 10px">
            <a-button @click="handleAdd"  type="primary" icon="plus-circle">新增</a-button>
            <a-button @click="batchDel" icon="minys-circle">删除</a-button>
          </a-space>
        </a-col>
      </a-row>
    </div>
    <div>
      <div style="background: #ffffff; border-radius: 5px; padding: 20px; padding-bottom: 100px; position: relative">
        <a-table
          :scroll="{ x: true }"
          :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
          :columns="columns"
          :data-source="dataSource"
          rowKey="id"
          :loading="loading"
          :pagination="false"
        >
          <!-- 操作 -->
          <a-space slot="action" slot-scope="text, record">
            <template>
              <a-button style="padding: 0px" type="link" icon="edit" @click="handleEdit(record)">编辑</a-button>
              <a-popconfirm
                title="确认要删除吗?"
                @confirm="() => handleDelete(record.id)"
              >
                <a-button style="color: red; padding: 0px" type="link" icon="delete" >删除</a-button>
              </a-popconfirm>

            </template>
          </a-space>
        </a-table>
        <a-pagination
          style="position: absolute; bottom: 10px"
          :default-current="ipagination.current"
          :total="ipagination.total"
          @change="onChangePage"
        />
        <span style="position: absolute; bottom: 10px; right: 20px">{{ ipagination.total }}结果</span>
      </div>
    </div>
    <!-- 表单区域 -->
    <device-modal ref="modalForm" @ok="modalFormOk"></device-modal>
  </div>
</template>

  <script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import DeviceModal from './modules/DeviceModal'
const path = '/crm_device/crmDevice'
export default {
  mixins: [JeecgListMixin],
  components: { DeviceModal },
  data() {
    return {
      level: undefined,
      objectValue: undefined,
      queryParam:{},
      object: [
        {
          label: '细沙',
          value: '1',
        },
        {
          label: '粗沙',
          value: '2',
        },
      ],
      columns: [
        {
          title: '公司',
          align: 'center',
          dataIndex: 'company_dictText',
          ellipsis: true,
        },
        {
          title: '设备号',
          align: 'center',
          dataIndex: 'deviceNo',
          ellipsis: true,
        },
        {
          title: '设备编号',
          align: 'center',
          dataIndex: 'productCode',
          ellipsis: true,
        },
        {
          title: '楼层',
          align: 'center',
          dataIndex: 'floor_dictText',
          ellipsis: true,
        },
        {
          title: '工序',
          align: 'center',
          dataIndex: 'workingProcedure_dictText',
          ellipsis: true,
        },
        {
          title: '车间',
          align: 'center',
          dataIndex: 'workshop_dictText',
          ellipsis: true,
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' },
          fixed: 'right',
        },
      ],
      url: {
        //调取列表的写法 地址是/list
        list: path + '/list',
        delete: path + '/delete',
        deleteBatch: path + '/deleteBatch'
      },
    }
  },

  mounted() {},

  methods: {
    changeObject() {},
    refresh() {
      this.searchQuery()
    },
    handleSearch() {
      this.searchQuery()
    },
    handleReset() {
      this.searchReset()
    },
    add() {
      this.visable1 = true
    },
    detail(record) {},
    onChangePage(e) {
      this.ipagination.current = e
      this.loadData()
    },
    btnImport() {},
    btnExport() {},
  },
}
</script>

  <style>
.body {
  background: #fff;
  padding: 15px;
}
</style>